<template>
    <div>
        <tableList
            :apis="apis"
            :headItems="headItems"
            :actItems="actItems"
            :formWidth="formWidth"
            :formItems="formItems"
            @actButEvent="actButEvent"
        ></tableList>
    </div>
</template>

<script>
    export default {
        name: 'ruler-list',
        components: {
        },
        data () {
            return {
                apis: {
                    list: this.$api.V2X_RULER_GET,
                    // detail: this.$api.V2X_RULER_GET,
                    delete: this.$api.V2X_RULER_DELETE,
                },
                headItems: [
                    { key: 'obj_id', label: '物体id' },
                    { key: 'created_at', label: '创建时间', type: 'datetime' },
                    { key: 'image_url', label: '图片地址', type: 'image' },
                    { key: 'lidar_id', label: '雷达id' },
                    { key: 'avg_distance', label: '平均距离' },
                    { key: 'max_distance', label: '最大距离' },
                    { key: 'min_distance', label: '最小距离' },
                    { key: 'speed', label: '速度' },
                    { key: 'length', label: '长度' },
                    { key: 'width', label: '宽度' },
                    { key: 'height', label: '高度' },
                    { key: 'lidar_x', label: 'x轴' },
                    { key: 'lidar_y', label: 'y轴' },
                    { key: 'lidar_z', label: 'z轴' },
                    { key: 'selection', label: '方式', type: 'dict' }
                ],
                actItems: [
                    {
                        label: "详情",
                        key: "detailAct",
                        type: "warning",
                        show: e => {
                            return e.status == 0 ? true : false;
                        }
                    }
                ],
                formWidth: '500',
                formItems: [
                    {
                        key: "avg_distance",
                        label: "平均距离",
                    },
                    {
                        key: "max_distance",
                        label: "最大距离",
                    },
                    {
                        key: "min_distance",
                        label: "最小距离"
                    },
                    {
                        key: "speed",
                        label: "速度"
                    },
                    {
                        key: "length",
                        label: "长度"
                    },
                    {
                        key: "width",
                        label: "宽度"
                    },
                    {
                        key: "height",
                        label: "高度"
                    },
                    {
                        key: "lidar_x",
                        label: "x轴"
                    },
                    {
                        key: "lidar_y",
                        label: "y轴"
                    },
                    {
                        key: "lidar_z",
                        label: "z轴"
                    }
                ],
            }
        },
        mounted() {
        },
        methods: {
            actButEvent(e) {
                this[e.eventName](e.val);
            },
            detailAct(e) {
                console.log(e)
                this.actStatus = e.status;
                this.title = e.time;
                this.id = e.id;
                this.apisAddDeduction.list.params.id = e.id;
                this.dialogDetailActVisible = true;
                this.formLoading = true;
                this.detailHeader();
                this.apisDetailAct.list.params.id = e.id;
                this.apisDetailAct.export.params.id = e.id;
                this.apisDetailAct.total.params.id = e.id;
            },
        }
    }
</script>
